/*
 * Copyright (c) 1999, 2000, Robert Grimm.
 *    All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided
 * with the distribution.
 *
 * 3. Neither name of Robert Grimm nor the names of his contributors
 * may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package one.util;

/**
 * Dummy class to support explicit monitor operations. This class
 * provides two static methods to acquire and release the monitor
 * associated with a Java object. The intent is to make it possible to
 * acquire and release Java monitors in a more flexible way than
 * provided by the Java <code>synchronized</code> statement. However,
 * the caller of <code>acquire()</code> and <code>release()</code>
 * subsequently assumes <i>all</i> responsibility for correctly
 * releasing acquired monitors, even in the presence of exceptions.</p>
 *
 * <p>Java classes which call the methods provided by this class must
 * be patched with the {@link MonitorFix monitor fix utility} before
 * actual use.</p>
 *
 * <p>Note that with the release of the second edition of the Java
 * virtual machine specification, new rules for the structured use of
 * locks have been introduced, which may be enforced by any given
 * JVM. See Section 8.13 of the specification.</p>
 *
 * @author   &copy; Copyright 1999 by Robert Grimm.
 *           Written by <a href="mailto:rgrimm@alum.mit.edu">Robert
 *           Grimm</a>.
 * @version  1.0
 */
public final class Monitor {

  /**
   * Create a new monitor object.
   */
  private Monitor() {
    // Nothing to do.
  }

  /**
   * Acquire the monitor associated with the specified object.
   * 
   * @param   o  The object whose monitor to acquire.
   * @throws  NullPointerException
   *             Signals that <code>null == o</code>.
   */
  public static void acquire(Object o) {
    // Nothing to do.
  }

  /**
   * Release the monitor associated with the specified object.
   *
   * @param   o  The object whose monitor to release.
   * @throws  NullPointerException
   *             Signals that <code>null == o</code>.
   * @throws  IllegalMonitorStateException
   *             Signals that the current thread is not the owner
   *             of the monitor associated with the specified object,
   *             or that the release violates the rules on structured
   *             use of locks as described in Section 8.13 of the
   *             Java virtual machine specification, second edition.
   */
  public static void release(Object o) {
    // Nothing to do.
  }

}
